package com.derbysoft.lowcostadapter.dswitch2.service.helper;

import com.derbysoft.remote.dswitch.generic.constants.AgeQualifyingType;
import com.derbysoft.remote.dswitch.hotel.dto.GuestCountDTO;

import java.util.List;

public abstract class GuestCountUtils {
    private static int getGuestCount(List<GuestCountDTO> guestCounts, AgeQualifyingType adult) {
        for (GuestCountDTO guestCount : guestCounts) {
            if (adult == guestCount.getAgeQualifyingType()) {
                return guestCount.getCount();
            }
        }
        return 0;
    }

    public static int getAdults(List<GuestCountDTO> guestCounts) {
        return getGuestCount(guestCounts, AgeQualifyingType.ADULT);
    }

    public static int getChildren(List<GuestCountDTO> guestCounts) {
        return getGuestCount(guestCounts, AgeQualifyingType.CHILD);
    }
}
